﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using POSSystem.DAL;

namespace POSSystem.BLL
{
    public class CustomerRequests : _CustomerRequests
    {
        public static CustomerRequests AddNewRequest(string name, string email, string address, string title, string content)
        {
            try
            {
                CustomerRequests r = new CustomerRequests();
                r.AddNew();
                r.Requestor = name;
                r.s_Email = email;
                r.s_Address = address;
                r.Title = title;
                r.Content = content;
                r.CreatedDate = DateTime.UtcNow.AddHours(SystemVariables.SysVars.TimeZone);
                r.Deleted = false;
                r.Unread = true;
                r.Important = false;
                r.BranchID = Branches.CurrentBranchID;
                r.Save();

                return r;
            }
            catch (Exception ex)
            {
                ErrorLog.WriteToFile("CustomerRequests.cs", "AddNewRequest", ex.StackTrace);
                throw ex;
            }
        }
    }
}
